<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
      <el-form-item label="试卷名称" prop="parperName">
        <el-input v-model="queryParams.parperName" placeholder="请输入试卷名称" clearable @keyup.enter.native="handleQuery" />
      </el-form-item>
      <!-- <el-form-item label="状态" prop="status">
        <el-select v-model="queryParams.status" placeholder="请选择状态" clearable>
          <el-option v-for="dict in dict.type.parper_status" :key="dict.value" :label="dict.label"
            :value="dict.value" />
        </el-select>
      </el-form-item> -->
      <el-form-item label="创建者" prop="createBy">
        <el-input v-model="queryParams.createBy" placeholder="请输入创建者" clearable @keyup.enter.native="handleQuery" />
      </el-form-item>
      <el-form-item label="创建时间">
        <el-date-picker v-model="daterangeCreateTime" style="width: 240px" value-format="yyyy-MM-dd" type="daterange"
          range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期"></el-date-picker>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>

    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd"
          v-hasPermi="['exa:parper:add']">新增</el-button>
      </el-col>
      <!-- <el-col :span="1.5">
        <el-button type="success" plain icon="el-icon-edit" size="mini" :disabled="single" @click="handleUpdate"
          v-hasPermi="['exa:parper:edit']">修改</el-button>
      </el-col> -->
      <!-- <el-col :span="1.5">
        <el-button type="danger" plain icon="el-icon-delete" size="mini" :disabled="multiple" @click="handleDelete"
          v-hasPermi="['exa:parper:remove']">删除</el-button>
      </el-col> -->
      <el-col :span="1.5">
        <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport"
          v-hasPermi="['exa:parper:export']">导出</el-button>
      </el-col>
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>

    <el-table v-loading="loading" :data="parperList">
      <!-- <el-table-column type="selection" width="55" align="center" /> -->
      <el-table-column label="ID" align="center" prop="id" />
      <el-table-column label="试卷名称" align="center" prop="parperName" />
      <el-table-column label="试题数量" align="center" prop="questionNum" />
      <el-table-column label="试卷分数" align="center" prop="parperScore" />
      <el-table-column label="通过分数" align="center" prop="passScore" />
      <el-table-column label="答题时间" align="center" prop="answeringTime" />
      <!-- <el-table-column label="状态" align="center" prop="status">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.parper_status" :value="scope.row.status" />
        </template>
</el-table-column> -->
      <el-table-column label="备注" align="center" prop="remark" />
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
        <template slot-scope="scope">
          <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
            v-hasPermi="['exa:parper:edit']">修改</el-button>
          <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
            v-hasPermi="['exa:parper:remove']">删除</el-button>
        </template>
      </el-table-column>
    </el-table>

    <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
      @pagination="getList" />

    <!-- 试卷编辑弹窗 -->
    <el-dialog :title="title" :visible.sync="open" width="1080px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
        <!-- 头部 -->
        <div class="top">
          <div class="t">
            <el-form-item label="试卷标题" prop="exaParper.parperName">
              <el-input v-model="form.exaParper.parperName" placeholder="请输入试卷名称" style="width: 180px;" />
            </el-form-item>

            <el-form-item label="通过分数" prop="exaParper.passScore">
              <el-input v-model="form.exaParper.passScore" placeholder="请输入通过分数" style="width: 180px;" />
            </el-form-item>

            <el-form-item label="答题时间" prop="exaParper.answeringTime">
              <el-input v-model="form.exaParper.answeringTime" placeholder="请输入答题时间(秒)" style="width: 180px;" />
            </el-form-item>
          </div>
          <div class="b">
            <el-button type="primary" @click="addTopic">添加题目</el-button>
            <el-button type="info" :disabled="form.exaClassVoList.length < 1" @click="preview">预览试卷</el-button>
          </div>
        </div>

        <!-- 题目与分数 -->
        <div class="bottom_form">
          <!-- 左侧题目 -->
          <div class="test-paper">
            <div class="test_paper_item" v-for="(item, index) in form.exaClassVoList" :key="index">
              <!-- 大题标题及操作 -->
              <div class="paper_title">
                <div class="paper_title_txt">{{ item.exaParperClass.className }}</div>
                <div class="paper_title_btn">
                  <el-button type="text" @click="addQuestions(item, index)" icon="el-icon-circle-plus">选择试题</el-button>
                  <el-button type="text" icon="el-icon-edit" @click="editTopic(item, index)">编辑</el-button>
                  <el-button type="text" icon="el-icon-error" @click="removeTopic(index)">删除</el-button>
                </div>
              </div>
              <!-- 小题列表 -->
              <div class="paper_gross">
                <div class="paper_gross_l_info" v-for="(question, qIndex) in item.exaClassQuestionsList" :key="qIndex">
                  <div class="paper_gross_l_info_top">
                    <div class="paper_gross_l_info_top_title">{{ qIndex + 1 }}、 {{
                      question.exaQuestionBankVo.exaQuestionBank.title }}</div>
                    <div class="paper_gross_l_info_top_fenshu">（{{ question.exaQuestionBankVo.exaQuestionBank.score }}分）
                    </div>
                  </div>
                  <div class="paper_gross_l_info_bottom_flex">
                    <!-- 选项 -->
                    <div class="paper_gross_l_info_bottom_l"
                      >
                      <div class="paper_gross_l_info_bottom" v-if="question.exaQuestionBankVo.exaQuestionBank.type != 4">
                        <div class="paper_gross_l_info_bottom_item"
                          :class="{ paper_gross_l_info_bottom_item_hover: option.rorw }"
                          v-for="(option, oIndex) in question.exaQuestionBankVo.exaQuestionOptionsList" :key="oIndex">
                          <span>{{ String.fromCharCode(65 + oIndex) }}. {{ option.content }}</span>
                        </div>
                      </div>
                    </div>
                    <!-- 小题操作 -->
                    <div class="paper_gross_l_info_bottom_r">
                      <el-button type="info" size="mini" plain @click="removeQuestion(item, qIndex)">删除</el-button>
                      <el-button type="info" size="mini" plain @click="moveUpQuestion(item, qIndex)"
                        :disabled="qIndex === 0">上移</el-button>
                      <el-button type="info" size="mini" plain @click="moveDownQuestion(item, qIndex)"
                        :disabled="qIndex === item.exaClassQuestionsList.length - 1">下移</el-button>
                      <el-button type="info" size="mini" plain @click="moveFirstQuestion(item, qIndex)"
                        :disabled="qIndex === 0">最前</el-button>
                      <el-button type="info" size="mini" plain @click="moveLastQuestion(item, qIndex)"
                        :disabled="qIndex === item.exaClassQuestionsList.length - 1">最后</el-button>
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </div>
          <!-- 右侧分数 -->
          <div class="paper-score">

            <div class="paper_score_top">
              <div class="all">题目总数：{{ totalQuestionCount }}</div>
              <div class="gross">试卷总分：{{ totalScore }}</div>
            </div>

            <div class="paper_score_bottom">
              <el-input type="textarea" :rows="7" placeholder="请输入备注内容。。。" v-model="form.exaParper.remark">
              </el-input>
            </div>

          </div>
        </div>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">保存试卷</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>

    <!-- 添加题目弹窗 -->
    <el-dialog title="添加题目" :visible.sync="open2" width="480px" append-to-body>
      <el-form ref="form2" :model="form2" :rules="rules2" label-width="80px">
        <el-form-item label="题目标题" prop="className">
          <el-input v-model="form2.className" placeholder="请输入试卷名称" />
        </el-form-item>

        <el-form-item label="选择类型" prop="type">
          <el-select v-model="form2.type" placeholder="请选择状态" clearable>
            <el-option v-for="dict in dict.type.question_type" :key="dict.value" :label="dict.label"
              :value="dict.value" />
          </el-select>
        </el-form-item>

        <el-form-item label="排序" prop="orderNum">
          <el-input type="number" v-model="form2.orderNum" placeholder="排序" style="width: 100px;" />
        </el-form-item>
      </el-form>

      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm2">确 定</el-button>
        <el-button @click="cancel2">取 消</el-button>
      </div>
    </el-dialog>

    <!-- 选择试题弹窗 -->
    <el-dialog title="添加题目" :visible.sync="open3" width="480px" append-to-body>
      <!-- <el-form :model="queryParams2" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
        <el-form-item label="试卷名称" prop="title"></el-form-item>
      </el-form> -->
      <el-table v-loading="loading2" :data="questionList" @selection-change="handleSelectionChange">
        <el-table-column type="index" label="序号" width="55" align="center" />
        <el-table-column label="试题ID" align="center" prop="id" />
        <el-table-column label="试题标题" align="center" prop="title" />
        <el-table-column label="试题分数" align="center" prop="score" />
        <el-table-column type="selection" width="55" align="center" :selectable="checkSelectable" />
      </el-table>
      <!-- 分页器 -->
      <pagination v-show="total2 > 0" :total="total2" :page.sync="queryParams2.pageNum"
        :limit.sync="queryParams2.pageSize" @pagination="getList" />


      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm3">确 定</el-button>
        <el-button @click="cancel3">取 消</el-button>
      </div>
    </el-dialog>

    <el-dialog class="pre_dialog" title="预览试卷" :visible.sync="open4" width="660px" append-to-body>
      <preview-parper :preData="preData"></preview-parper>
    </el-dialog>
  </div>
</template>

<script>
import { listParper, getParper, delParper, delParper2, addParper, updateParper, saveOrUpdate, getParperInfo } from "@/api/exa/parper"
import { listBank, getBank } from "@/api/exa/bank"
import { listOptions } from "@/api/exa/options"
import previewParper from "@/components/parper/index.vue"
import { Form } from "element-ui"

export default {
  name: "Parper",
  dicts: ['parper_status', 'question_type'],
  components: {
    previewParper
  },
  data() {
    return {
      loading: true,
      loading2: false,
      ids: [],
      single: true,
      multiple: true,
      showSearch: true,
      total: 0,
      total2: 0,
      parperList: [],
      title: "",
      open: false,
      open2: false,
      open3: false,
      open4: false,
      daterangeCreateTime: [],
      queryParams: { pageNum: 1, pageSize: 10, parperName: null, createBy: null, createTime: null },
      queryParams2: { pageNum: 1, pageSize: 10, title: null, score: null, type: null, createBy: null },
      form: { exaParper: { id: null, parperName: null, questionNum: null, parperScore: null }, exaClassVoList: [] },
      form2: {},
      formList: {},
      rules: {
        "exaParper.parperName": [
          { required: true, message: "试卷名称不能为空", trigger: "blur" },
          { min: 2, max: 50, message: "试卷名称长度在2-50个字符之间", trigger: "blur" }
        ],
        "exaParper.passScore": [
          { required: true, message: "通过分数不能为空", trigger: "blur" },
          // { type: 'number', message: '通过分数必须为数字', trigger: 'blur' }
        ],
        "exaParper.answeringTime": [
          { required: true, message: "答题时间不能为空", trigger: "blur" },
          // { type: 'number', message: '答题时间必须为数字', trigger: 'blur' }
        ]
      },
      rules2: {
        className: [
          { required: true, message: "题目标题不能为空", trigger: "blur" }
        ],
        type: [
          { required: true, message: "请选择类型", trigger: "change" }
        ]
      },
      questionList: [],
      currentClassIndex: -1,
      exaQuestionOptionsList: [],
      editTopicIndex: null,
      editTopicForm: { className: '', classId: '' },
      preData: {}, // 预览数据
    }
  },
  created() {
    this.getList()
  },
  computed: {
    // 题目总数
    totalQuestionCount() {
      return this.form.exaClassVoList.reduce((sum, group) => sum + (group.exaClassQuestionsList ? group.exaClassQuestionsList.length : 0), 0);
    },
    // 试卷总分
    totalScore() {
      return this.form.exaClassVoList.reduce((sum, group) => {
        if (!group.exaClassQuestionsList) return sum;
        return sum + group.exaClassQuestionsList.reduce((s, q) => s + (Number(q.exaQuestionBankVo.exaQuestionBank.score) || 0), 0);
      }, 0);
    }
  },
  watch: {
    open4(val) {
      if (!val) {
        this.preData = {};
      }
    }
  },
  methods: {
    /** 查询试卷管理列表 */
    getList() {
      this.loading = true
      this.queryParams.params = {}
      if (this.daterangeCreateTime && this.daterangeCreateTime.length) {
        this.queryParams.params["beginCreateTime"] = this.daterangeCreateTime[0]
        this.queryParams.params["endCreateTime"] = this.daterangeCreateTime[1]
      }
      listParper(this.queryParams).then(response => {
        this.parperList = response.rows
        this.total = response.total
        this.loading = false
      })
    },
    // 添加题目
    addTopic() {
      this.open2 = true
    },

    // 预览试卷
    preview() {
      if (this.form.exaClassVoList.length < 1) {
        this.$modal.msgError("请先添加题目");
        return;
      }
      this.form.exaParper.parperScore = this.totalScore;
      this.form.exaParper.questionNum = this.totalQuestionCount;
      this.preData = JSON.parse(JSON.stringify(this.form));
      this.open4 = true;
    },
    cancelPreview() {
      this.open4 = false;
      this.preData = {};
    },
    // 获取题库
    getlistBank() {
      if (!this.queryParams2.type) {
        this.$modal.msgError("请先选择试题类型");
        return;
      }
      this.loading2 = true;
      listBank(this.queryParams2).then(res => {
        this.loading2 = false;
        if (res.code == 200 && res.rows.length > 0) {
          this.questionList = res.rows;
          this.total2 = res.total;

        } else {
          this.$modal.msgWarning("没有可用的试题");
        }
      })
    },
    // 选择试题
    addQuestions(item, index) {
      if (!item || !item.exaParperClass.type) {
        this.$modal.msgError("试题类型不能为空");
        return;
      }
      this.currentClassIndex = index;
      this.queryParams2.type = item.exaParperClass.type;
      this.getlistBank();
      this.open3 = true;
    },
    // 获取试题选项（重载，支持新结构）
    getAnswerForQuestion(questionId, qIndex, currentClass) {
      getBank(questionId).then(response => {
        listOptions({ questionId: response.data.id }).then(res => {
          // 答案选项数据
          this.$set(currentClass.exaClassQuestionsList[qIndex].exaQuestionBankVo, 'exaQuestionOptionsList', res.rows);
        });
      });
    },
    // 编辑大题
    editTopic(item, index) {
      console.log(item, index);

      // 进入编辑状态
      //  this.editTopicIndex = index;
      // // 填充弹窗表单
      // this.form2 = {
      //   className: item.exaParperClass.className,
      //   type: item.exaParperClass.type,
      //   orderNum: item.exaParperClass.orderNum || 0
      // };
      // this.open2 = true;

      this.editTopicIndex = index;
      this.editTopicForm = { className: item.exaParperClass.className, classId: item.exaParperClass.classId };
      this.$prompt('请输入新的题目名称', '编辑题目', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        inputValue: item.exaParperClass.className,
        inputPattern: /.+/,
        inputErrorMessage: '题目名称不能为空'
      }).then(({ value }) => {
        this.form.exaClassVoList[index].exaParperClass.className = value;
      }).catch(() => { });
    },
    // 删除大题
    removeTopic(index) {
      this.$confirm('确定要删除该题型及其下所有试题吗？', '提示', { type: 'warning' }).then(() => {
        this.form.exaClassVoList.splice(index, 1);
      }).catch(() => { });
    },
    // 删除试题
    removeQuestion(item, qIndex) {
      this.$confirm('确定要删除该题目吗？', '提示', { type: 'warning' }).then(() => {
        item.exaClassQuestionsList.splice(qIndex, 1);
        this.$message.success('删除成功');
      }).catch(() => { });
    },
    // 上移
    moveUpQuestion(item, qIndex) {
      if (qIndex > 0) {
        const list = item.exaClassQuestionsList;
        const temp = list[qIndex];
        list.splice(qIndex, 1);
        list.splice(qIndex - 1, 0, temp);
      }
    },
    // 下移
    moveDownQuestion(item, qIndex) {
      const list = item.exaClassQuestionsList;
      if (qIndex < list.length - 1) {
        const temp = list[qIndex];
        list.splice(qIndex, 1);
        list.splice(qIndex + 1, 0, temp);
      }
    },
    // 最前
    moveFirstQuestion(item, qIndex) {
      if (qIndex > 0) {
        const list = item.exaClassQuestionsList;
        const temp = list.splice(qIndex, 1)[0];
        list.unshift(temp);
      }
    },
    // 最后
    moveLastQuestion(item, qIndex) {
      const list = item.exaClassQuestionsList;
      if (qIndex < list.length - 1) {
        const temp = list.splice(qIndex, 1)[0];
        list.push(temp);
      }
    },
    // 判断是否可选
    checkSelectable(row) {
      const currentClass = this.form.exaClassVoList[this.currentClassIndex];
      if (!currentClass) return true;
      const isExist = currentClass.exaClassQuestionsList.some(
        item => item.exaQuestionBankVo && item.exaQuestionBankVo.exaQuestionBank && item.exaQuestionBankVo.exaQuestionBank.id === row.id
      );
      return !isExist;
    },
    // 取消按钮
    cancel() {
      this.open = false
      this.reset()
    },
    cancel2() {
      this.open2 = false
      this.form2 = {}
    },
    cancel3() {
      this.open3 = false;
      this.formList = [];
      this.currentClassIndex = -1;
    },
    // 表单重置
    reset() {
      this.form = {
        exaParper: { id: null, parperName: null, questionNum: null, parperScore: null },
        exaClassVoList: []
      }
      this.resetForm("form")
    },
    // 搜索
    handleQuery() {
      this.queryParams.pageNum = 1
      this.getList()
    },
    // 重置
    resetQuery() {
      this.daterangeCreateTime = []
      this.resetForm("queryForm")
      this.handleQuery()
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      console.log(selection);

      this.formList = selection
      this.ids = selection.map(item => item.id)
      this.single = selection.length !== 1
      this.multiple = !selection.length
    },
    // 新增按钮
    handleAdd() {
      this.reset()
      this.open = true
      this.title = "添加试卷管理"
    },
    // 修改按钮
    handleUpdate(row) {
      console.log(row);

      this.reset()
      const id = row.id || this.ids
      getParperInfo({ parperId: id }).then(res => {
        console.log(res);

        this.form = res.data
        this.open = true
        this.title = "修改试卷管理"
      })
    },
    // 提交按钮
    submitForm() {
      this.$refs["form"].validate(valid => {
        if (valid) {

          this.form.exaParper.parperScore = this.totalScore           // 试卷总分
          this.form.exaParper.questionNum = this.totalQuestionCount   // 题目总数

          if (this.form.id != null) {
            saveOrUpdate(this.form).then(response => {
              this.$modal.msgSuccess("修改成功")
              this.open = false
              this.getList()
            })
          } else {
            console.log(this.form);

            saveOrUpdate(this.form).then(response => {
              this.$modal.msgSuccess("新增成功")
              this.open = false
              this.getList()
            })
          }
        }
      })
    },
    // 添加题目提交
    submitForm2() {
      this.$refs["form2"].validate(valid => {
        if (valid) {
          const newTopic = {
            exaParperClass: {
              className: this.form2.className,
              type: this.form2.type,
            },
            exaClassQuestionsList: []
          }
          this.form.exaClassVoList.push(newTopic)
          this.$modal.msgSuccess("题目添加成功")
          this.form2 = { className: '', classId: '' }
          this.open2 = false
        }
      })
    },
    // 选择试题提交
    submitForm3() {
      if (this.currentClassIndex === -1) {
        this.$modal.msgError("请先选择题目类型");
        return;
      }
      if (!this.formList || this.formList.length === 0) {
        this.$modal.msgWarning("请选择要添加的试题");
        return;
      }
      const currentClass = this.form.exaClassVoList[this.currentClassIndex];
      if (currentClass) {
        this.formList.forEach(item => {
          // 构建新结构
          const questionObj = {
            exaClassQuestions: {
              classId: currentClass.exaParperClass.id || '',
              // orderNum: 0,
              questionId: item.id,
            },
            exaQuestionBankVo: {
              exaQuestionBank: {
                id: item.id,
                images: "",
                score: item.score,
                title: item.title,
                type: item.type,
              },
              exaQuestionOptionsList: []
            }
          };
          // 获取选项并填充到新结构
          this.getAnswerForQuestion(item.id, currentClass.exaClassQuestionsList.length, currentClass, questionObj);
          // 先插入，选项异步填充
          currentClass.exaClassQuestionsList.push(questionObj);
        });
        this.$modal.msgSuccess("试题添加成功");
        this.open3 = false;
        this.formList = [];
        this.currentClassIndex = -1;
      }
    },
    // 列表删除
    handleDelete(row) {
      const ids = row.id || this.ids
      this.$modal.confirm('是否确认删除试卷管理编号为"' + ids + '"的数据项？').then(function () {
        return delParper2(ids)
      }).then(() => {
        this.getList()
        this.$modal.msgSuccess("删除成功")
      }).catch(() => { })
    },
    // 导出
    handleExport() {
      this.download('exa/parper/export', { ...this.queryParams }, `parper_${new Date().getTime()}.xlsx`)
    }
  }
}
</script>

<style lang="scss" scoped>
::v-deep .el-dialog {
  background-color: #F1F4F6;

  .top {
    width: 100%;
    height: 100%;
    margin-bottom: 20px;
    padding: 10px;
    box-sizing: border-box;
    background-color: #fff;
    display: flex;
    justify-content: space-between;
    align-items: center;

    .t {
      display: flex;
      height: 36px;

      .el-form-item {
        height: 36px !important;
      }
    }
  }

  .bottom_form {
    width: 100%;
    min-height: 400px;
    display: flex;
    justify-content: space-between;
    // align-items: center;

    .test-paper {
      width: 80%;
      min-height: 400px;
      padding: 20px;
      box-sizing: border-box;
      background-color: #fff;

      .test_paper_item {
        border-bottom: 1px solid #f2f2f2;
        margin-bottom: 20px;

        .paper_title {
          width: 100%;
          height: 60px;
          line-height: 60px;
          // background-color: #000;
          // border-bottom: 2px dashed #ccc;
          display: flex;
          justify-content: space-between;
          align-items: center;

          .paper_title_txt {
            font-size: 24px;
            font-weight: 700;
          }

          .paper_title_btn {
            width: 33%;
            // background-color: #ccc;
            padding: 0 10px;
            box-sizing: border-box;
            display: flex;
            justify-content: space-between;

            .el-button {
              color: #7F7F7F !important;
            }
          }
        }

        .paper_gross {
          min-height: 160px;
          display: flex;
          flex-direction: column;
          justify-content: space-between;
          // align-items: center;
          border-top: 1px solid #f2f2f2;
          border-top: 2px dashed #ccc;
          border-bottom: 2px dashed #ccc;
          margin-bottom: 40px;
          padding-bottom: 30px;
          box-sizing: border-box;

          // background-color: #000;

          .paper_gross_l_info {
            margin-top: 20px;
            padding: 0 20px;
            box-sizing: border-box;

            .paper_gross_l_info_top {
              width: 440px;
              margin-bottom: 20px;
              padding-right: 15px;
              box-sizing: border-box;
              font-size: 18px;
              display: flex;
              justify-content: space-between;
              align-items: center;
            }

            .paper_gross_l_info_bottom_flex {
              display: flex;
              justify-content: space-between;
              align-items: end;

              .paper_gross_l_info_bottom_l {
                width: 440px;

                .paper_gross_l_info_bottom {
                  width: 400px !important;
                  padding: 0 20px;
                  box-sizing: border-box;
                  border-radius: 5px;

                  .paper_gross_l_info_bottom_item {
                    width: 100%;
                    line-height: 40px;
                    font-size: 16px;
                    border: 1px solid #F0F0F0;
                    // background-color: #000;
                    margin-top: 10px;
                    padding: 5px 10px;
                    box-sizing: border-box;
                    border-radius: 5px;
                    color: #333;
                    cursor: pointer;

                    // &:hover {
                    //   background-color: #FFF3F3;
                    //   border-color: #ECACAC;
                    // }
                  }

                  .paper_gross_l_info_bottom_item_hover {
                    background-color: #FFF3F3;
                    border-color: #ECACAC;
                  }
                }
              }

              .paper_gross_l_info_bottom_r {
                width: 300px;
                // overflow: hidden;
                display: flex;
                align-items: end;
              }
            }
          }
        }
      }


    }

    .paper-score {
      width: 20%;
      height: 160px;
      margin-left: 10px;
      background-color: #fff;
      color: #7F7F7F;

      .paper_score_top {
        padding: 0 20px;
        box-sizing: border-box;

        .all,
        .gross {
          line-height: 80px;
          font-size: 18px;
        }

        .all {
          border-bottom: 1px solid #ebe1e1;
        }
      }

      .paper_score_bottom {
        // width: 100%;
        height: 160px;
        margin-top: 10px;
        // padding: 10px 20px;
        // box-sizing: border-box;
        background-color: #fff;
        color: #7F7F7F;

        .el-input {
          width: 100%;
        }
      }

    }
  }
}

::v-deep textarea {
  border: none;
  resize: none;
}

.pre_dialog {

  ::v-deep .el-dialog {
    background-color: #fff;

    .el-dialog__body {
      padding: 0 20px !important;
    }
  }
}
</style>